package com.qq.aop;

import com.qq.anonatation.LogAnotation;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LogAspect {

    @Around("@annotation(logAnotation)")
    public Object around(ProceedingJoinPoint joinPoint, LogAnotation logAnotation) throws Throwable {
        System.out.println("环绕通知开始");
        System.out.println("方法名称：" + logAnotation.value());
        Object res = joinPoint.proceed();
        System.out.println("环绕通知结束");
        return res;
    }
}
